<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>组件中的数据存放问题</title>
  </head>
  <body>
    <div id="app">
      <cpn> </cpn>
    </div>

    <!-- 2.template标签 -->
    <template id="cpn">
      <div>
        <h2>{{title}}</h2>
        <p>动动可以吗？</p>
      </div>
    </template>
    <script src="../vue.js"></script>
    <script>
      //注册一个全局组件
      Vue.component("cpn", {
        template: "#cpn",
        data() {
          return {
            title: "123",
          };
        },
      });

      const app = new Vue({
        el: "#app",
        data: {
          messahe: "hello",
        },
      });
    </script>
  </body>
</html>
